package com.gxa.pojo;

import java.io.Serializable;
import java.sql.Timestamp;
import java.util.Date;
import java.util.List;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.gxa.groups.LoginByName;
import com.gxa.groups.LoginByPhone;
import lombok.Data;

import javax.validation.constraints.Pattern;

/**
 * user
 * @author 
 */
@Data
public class User implements Serializable {
    /**
     * 用户id
     */
    private Integer userId;

    /**
     * 用户名
     */
    @Pattern(regexp = "^[\\u4e00-\\u9fa5_a-zA-Z0-9_]{2,8}$", groups = {LoginByName.class}, message = "用户名必须为2-8个字符")
    private String userName;

    /**
     * 用户密码
     */
    @Pattern(regexp = "^(.+){6,12}$", groups = {LoginByName.class}, message = "密码必须为6-12个字符")
    private String userPassword;

    /**
     * 用户电话
     */
    @Pattern(regexp = "^(0|86|17951)?(13[0-9]|15[012356789]|166|17[3678]|18[0-9]|14[57])[0-9]{8}$", message = "手机号码格式不正确", groups = {LoginByPhone.class})
    private String userPhone;

    /**
     * 用户是否被删除 0未删除 1已删除
     */
    private Byte userIsDeleted;

    /**
     * 用户创建时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Timestamp userCreateTime;

    /**
     * 用户更新时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Timestamp userUpdateTime;

    /**
     * 用户所拥有的角色
     */
    private List<Role> roleList;

    private static final long serialVersionUID = 1L;
}